Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.default = void 0);
var e = require("../../@babel/runtime/helpers/classCallCheck"),
  t = require("../../@babel/runtime/helpers/createClass"),
  r = (exports.default = (function () {
    return t(
      function t() {
        e(this, t), (this.events = {});
      },
      [
        {
          key: "getListeners",
          value: function (e) {
            return this.events[e] || (this.events[e] = []);
          },
        },
        {
          key: "addListener",
          value: function (e, t) {
            return this.getListeners(e).push(t), this;
          },
        },
        {
          key: "removeListener",
          value: function (e, t) {
            var r = this.getListeners(e),
              s = r.indexOf(t);
            return s > -1 && r.splice(s, 1), this;
          },
        },
        {
          key: "trigger",
          value: function (e) {
            for (
              var t = this.getListeners(e).slice(0),
                r = arguments.length,
                s = new Array(r > 1 ? r - 1 : 0),
                i = 1;
              i < r;
              i++
            )
              s[i - 1] = arguments[i];
            for (var n = 0, u = t.length; n < u; n++) t[n].apply(t, s);
            return this;
          },
        },
        {
          key: "once",
          value: function (e, t) {
            var r = this;
            return (
              this.getListeners(e).push(function s() {
                r.removeListener(e, s), t.apply(void 0, arguments);
              }),
              this
            );
          },
        },
      ],
    );
  })()).prototype;
(r.on = r.addListener), (r.off = r.removeListener), (r.emit = r.trigger);
